package com.tanhua.manage.controller;

import com.tanhua.manage.service.OprationService;
import com.tanhua.manage.util.NoAuthorization;
import com.tanhua.manage.vo.OprationLogVo;
import com.tanhua.manage.vo.Pager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/management/manage/findLog")
public class OprationController {
    @Autowired
    private OprationService oprationService;


    /**
     *
     * @param page
     * @param pageSize
     * @param userName
     * @param operationMethod
     * @param sd
     * @param ed
     * @return
     */
    @GetMapping
    //@NoAuthorization
    public Pager<OprationLogVo> findLogByPage(@RequestParam(name = "page", defaultValue = "1") Integer page,
                                              @RequestParam(name = "pagesize", defaultValue = "10") Integer pageSize,
                                              @RequestParam(name = "userName", required = false) String userName,
                                              @RequestParam(name = "operationMethod", required = false) String operationMethod,
                                              @RequestParam(name = "sd", required = false) String sd,
                                              @RequestParam(name = "ed", required = false) String ed) {
        return this.oprationService.findLogByPage(page,pageSize,userName,operationMethod,sd,ed);
    }

    @GetMapping("{id}")
    public String findOprationDetails(@PathVariable Integer id){
        return this.oprationService.findOprationDetails(id);
    }

}